package com.eversec.msg.config;

import org.apache.activemq.ActiveMQConnectionFactory;
import org.apache.activemq.command.ActiveMQQueue;
import org.apache.activemq.command.ActiveMQTopic;
import org.apache.activemq.pool.PooledConnectionFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.jms.core.JmsTemplate;

/**
 * Created by eversec on 2018/3/2.
 */
@Configuration
public class ActivemqConfig {

    public final static String REPLY = "REPLY_Q_FM_OMC_EYRJ";
    public final static String QUEUE = "Q_FM_OMC_EYRJ";
//
//    public String brokerURL = "failover:(tcp://10.186.89.199:61616)?maxReconnectAttempts=10&amp;maxReconnectDelay=5000";
//
//    public ActiveMQConnectionFactory activeMQConnectionFactory ;
//
//    public PooledConnectionFactory pooledConnectionFactory ;
//
//    public int maxConnections = 5 ;
//
//    public JmsTemplate jmsTemplate ;
//
    @Bean("queueDestination")
    public ActiveMQQueue queue() {
        return new ActiveMQQueue(QUEUE);
    }

    @Bean("replyDestination")
    public ActiveMQTopic topic() {
        return new ActiveMQTopic(REPLY);
    }
//
//    @Bean
//    public ActiveMQConnectionFactory factory() {
//        activeMQConnectionFactory = new ActiveMQConnectionFactory(brokerURL);
//        return activeMQConnectionFactory;
//    }
//
//    @Bean
//    public PooledConnectionFactory pooledConnectionFactory() {
//        pooledConnectionFactory = new PooledConnectionFactory(activeMQConnectionFactory);
//        pooledConnectionFactory.setMaxConnections(5);
//        return pooledConnectionFactory ;
//    }
//
//    @Bean
//    public JmsTemplate jmsTemplate() {
//        return new JmsTemplate(activeMQConnectionFactory);
//    }

}
